// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://localhost/webservice/QiBizOnWeb.dll/wsdl/IDataService
// Encoding : utf-8
// Version  : 1.0
// (2006-10-31 11:25:39 - 1.33.2.5)
// ************************************************************************ //

unit uIDataService;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns,Classes,sysutils;

type

  // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Borland types; however, they could also 
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:string          - "http://www.w3.org/2001/XMLSchema"
  // !:TStringDynArray - "http://www.borland.com/namespaces/Types"
  // !:anyType         - "http://www.w3.org/2001/XMLSchema"

  TServiceHeader       = class;                 { "urn:DataServiceIntf"[H] }



  // ************************************************************************ //
  // Namespace : urn:DataServiceIntf
  // ************************************************************************ //
  TServiceHeader = class(TSOAPHeader)
  private
    FAuthenInfo: WideString;
    FUserLoginInfo: TStringDynArray;
  published
    property AuthenInfo: WideString read FAuthenInfo write FAuthenInfo;
    property UserLoginInfo: TStringDynArray read FUserLoginInfo write FUserLoginInfo;
  end;


  // ************************************************************************ //
  // Namespace : urn:DataServiceIntf-IDataService
  // soapAction: urn:DataServiceIntf-IDataService#%operationName%
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : rpc
  // binding   : IDataServicebinding
  // service   : IDataServiceservice
  // port      : IDataServicePort
  // URL       : http://localhost/webservice/QiBizOnWeb.dll/soap/IDataService
  // ************************************************************************ //
  IDataService = interface(IInvokable)
  ['{8B6EB8A5-94BC-EF60-9D8B-6227183CF24E}']
    function  GetUpdateUrl: WideString; stdcall;
    function  GetBySqls(const sqls: TStringDynArray): TStringDynArray; stdcall;
    procedure UpdateBySqls(const sqls: TStringDynArray); stdcall;
    function  ExecuteReport(const ReportId: WideString; const Params: TStringDynArray): Variant; stdcall;
    function  GetReportList: WideString; stdcall;
    procedure RebootCom; stdcall;
  end;

function GetIDataService(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): IDataService;


implementation
uses codemyth.utils;


function GetIDataService(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): IDataService;
const
  defWSDL = 'http://localhost/QiWs/QiBizOnWeb.dll/wsdl/IDataService';
  defURL  = 'http://localhost/QiWs/QiBizOnWeb.dll/soap/IDataService';
  defSvc  = 'IDataServiceservice';
  defPrt  = 'IDataServicePort';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as IDataService);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;


initialization
  InvRegistry.RegisterInterface(TypeInfo(IDataService), 'urn:DataServiceIntf-IDataService', 'utf-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(IDataService), 'urn:DataServiceIntf-IDataService#%operationName%');
  InvRegistry.RegisterHeaderClass(TypeInfo(IDataService), TServiceHeader, 'TServiceHeader', 'urn:DataServiceIntf');
  RemClassRegistry.RegisterXSClass(TServiceHeader, 'urn:DataServiceIntf', 'TServiceHeader');

end.